<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <title>爬虫任务管理</title>
    <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
    <link href="../../node_modules/layui/dist/css/layui.css" rel="stylesheet">
    <script src="../../node_modules/layui/dist/layui.js"></script>
    <style>
        html,
        body {
            height: 100%;
            margin: 0;
            padding: 0;
        }

        body {
            display: flex;
            flex-direction: column;
            background-color: #f5f5f5;
        }

        .search-container {
            background: white;
            padding: 15px;
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .result-container {
            background: white;
            padding: 15px;
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            flex: 1;
            /* 占据剩余空间 */
            display: flex;
            /* 设置为 Flexbox 容器 */
            flex-direction: column;
            /* 垂直排列子元素 */
            margin-top: 15px;
            overflow: hidden;
            /* 防止内容溢出 */
        }

        #result-list {
            flex: 1;
            /* 占据剩余空间 */
            overflow-y: auto;
            /* 内容过多时生成滚动条 */
            max-height: calc(100vh - 200px);
            /* 动态计算最大高度 */
        }

        #pagination {
            flex-shrink: 0;
            /* 防止分页组件被压缩 */
            text-align: center;
            margin-top: 20px;
        }

        .crawler-item {
            padding: 10px;
            border-bottom: 1px solid #f0f0f0;
            display: flex;
            align-items: center;
            transition: background-color 0.3s;
        }

        .crawler-item:hover {
            background-color: #f9f9f9;
        }

        .crawler-info {
            flex: 1;
        }

        .crawler-title {
            font-size: 16px;
            color: #1E9FFF;
            margin-bottom: 8px;
        }

        .crawler-meta {
            color: #999;
            font-size: 13px;
            margin-bottom: 8px;
        }

        .crawler-url {
            color: #666;
            font-size: 14px;
            word-break: break-all;
        }

        .tag {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 12px;
            margin-right: 8px;
            color: white;
        }

        .c0 {
            background-color: #1E9FFF;
        }

        .c1 {
            background-color: #009688;
        }

        .c2 {
            background-color: #FFB800;
        }

        .c3 {
            background-color: #ff5722;
        }

        .c4 {
            background-color: #dd56ff;
        }

        .action-buttons {
            white-space: nowrap;
            padding-left: 20px;
        }

        .search-form {
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }

        .search-form .layui-form-item {
            margin-bottom: 0;
        }

        .search-keywords {
            flex: 1;
        }

        .sort-options {
            flex: 0 0 auto;
        }

        .sort-radios {
            display: flex;
            gap: 10px;
        }

        .sort-radios .layui-form-radio {
            margin: 0;
            padding-right: 0;
        }

        .sort-radios .layui-form-radio * {
            font-size: 13px;
        }

        .radio-label {
            display: flex;
            align-items: center;
            cursor: pointer;
            user-select: none;
        }

        .radio-label input[type="radio"] {
            display: none;
        }

        .radio-text {
            padding: 4px 10px;
            font-size: 13px;
            transition: all 0.3s;
            background-color: white;
            color: #666;
            border-radius: 3px;
        }

        .radio-label input[type="radio"]:checked + .radio-text {
            background-color: #2c3e50;
            color: white;
        }

        .radio-text {
            border: none;
            background-color: #f5f5f5;
        }

        .radio-label:hover .radio-text {
            background-color: #e8e8e8;
        }


        .search-row:last-child {
            margin-bottom: 0;
        }

        .search-keywords {
            width: 100%;
        }

        .search-keywords .layui-input {
            width: 100%;
            height: 40px;
        }

        .options-row {
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }

        .category-select {
            width: 180px;
            flex: 0 0 auto;
        }

        .sort-options {
            flex: 1;
            margin: 0;
        }

        .button-group {
            flex: 0 0 auto;
            display: flex;
            gap: 8px;
        }

        .search-input-wrapper {
            position: relative;
            width: 100%;
        }

        .search-input-wrapper input {
            padding-left: 35px;
            padding-right: 10px;
            font-size: 15px;
            transition: all 0.3s;
        }

        .search-input-wrapper input:focus {
            border-color: #2c3e50;
            box-shadow: 0 0 8px rgba(44, 62, 80, 0.1);
        }

        .search-icon {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
            font-style: normal;
            font-size: 16px;
            pointer-events: none;
            transition: color 0.3s;
        }

        .search-input-wrapper input:focus + .search-icon {
            color: #2c3e50;
        }

        .search-keywords .layui-input {
            height: 46px;
            border-radius: 6px;
        }

        .search-input-wrapper:hover input {
            border-color: #2c3e50;
        }

        .search-input-wrapper:hover .search-icon {
            color: #666;
        }

        /* 类别标签样式 */
        .selected-categories {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            min-height: 24px;
        }

        .category-tag {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            background-color: #1E9FFF;
            color: white;
            border-radius: 12px;
            font-size: 12px;
            box-shadow: 0 1px 2px rgba(30, 159, 255, 0.2);
            transition: all 0.2s ease;
        }

        .category-tag:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(30, 159, 255, 0.3);
        }

        .category-tag .close-btn {
            margin-left: 4px;
            cursor: pointer;
            font-size: 14px;
            opacity: 0.8;
            font-weight: bold;
            width: 14px;
            height: 14px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            margin-right: -2px;
        }

        .category-tag .close-btn:hover {
            opacity: 1;
            background-color: rgba(255, 255, 255, 0.3);
        }
    </style>
</head>

<body>
<!-- 搜索区域 -->
<div class="search-container">
    <form class="layui-form">
        <!-- 搜索框独立一行 -->
        <div class="search-row">
            <div class="layui-form-item search-keywords">
                <div class="search-input-wrapper">
                    <i class="search-icon">&#128269;</i>
                    <input type="text" name="keywords" placeholder="请输入关键词" class="layui-input">
                </div>
            </div>
        </div>

        <!-- 其他选项放在第二行 -->
        <div class="search-row options-row">
            <div class="layui-form-item category-select">
                <select name="category" lay-filter="category" id="category-selector">
                    <option value="">选择类别(至多三项)</option>
                    <!-- 从后端读取所有类别 -->
                </select>
            </div>

            <div class="layui-form-item sort-options">
                <div class="sort-radios">
                    <input type="radio" name="sort" value="timeAsc" title="时间顺序" lay-filter="sortFilter">
                    <input type="radio" name="sort" value="timeDesc" title="时间倒序" lay-filter="sortFilter">
                    <input type="radio" name="sort" value="relevanceAsc" title="相关度顺序" lay-filter="sortFilter">
                    <input type="radio" name="sort" value="relevanceDesc" title="相关度倒序" lay-filter="sortFilter">
                    <input type="radio" name="sort" value="none" title="无" lay-filter="sortFilter" checked>
                </div>
            </div>

            <div class="button-group">
                <button class="layui-btn" lay-submit id="searchBtn">搜索</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <button type="reset" class="layui-btn layui-btn-primary" id="backBtn">退出</button>
            </div>
        </div>

        <!-- 将类别标签显示区域移到新的一行 -->
        <div class="search-row">
            <div class="selected-categories" id="selectedCategories">
                <!-- 这里将通过JavaScript动态添加选中的类别标签 -->
            </div>
        </div>
    </form>
</div>

<!-- 结果列表 -->
<div class="result-container">
    <div id="result-list">


        <!-- 更多列表项... -->
    </div>

    <!-- 分页 -->
    <div id="pagination"></div>
</div>

<script src="crawler_manage_render.js"></script>

</body>

</html>